<!DOCTYPE html>
<html>
    <head>
        <title>Laravel</title>

        <link href="https://fonts.googleapis.com/css?family=Lato:100" rel="stylesheet" type="text/css">
		<!--ajax需要设置meta标签中的令牌信息-->
		<meta name="csrf-token" content="{{ csrf_token() }}">
        <style>
            html, body {
                height: 100%;
            }

            body {
                margin: 0;
                padding: 0;
                width: 100%;
                display: table;
                font-weight: 100;
                font-family: 'Lato';
            }

            .container {
                text-align: center;
                display: table-cell;
                vertical-align: middle;
            }

            .content {
                text-align: center;
                display: inline-block;
            }

            .title {
                font-size: 96px;
            }
        </style>
		<script src="./jquery-1.7.2.js"></script>
    </head>
    <body>
		<button>发起ajax请求</button>
		<script>
			$('button').click(function(){
			
				//ajax共用设置设置令牌
				$.ajaxSetup({
					headers: {
						'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
					}
			});
			
				//ajax请求
				$.ajax({
				
					url:'/ajaxResult',
					type:'post',
					dataType:'text',
					success:function(data){
					alert(data);
					}
					
				});
			});
		</script>
    </body>
</html>
